﻿using Sys.Common;
using Sys.Core.Gen;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ResAndSurvey : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    public string GetSurvery()
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();

        var list = NewBll.I.NewsByTag("Survery").Take(5).ToList();

        sb.Append("<ul>");

        for (int i = 0; i < list.Count; i++)
        {
            var item = list[i];

            switch (i + 1)
            {
                case 1: sb.Append("<li class='blank'>"); break;
                case 2: sb.Append("<li class='orange'>"); break;
                case 3: sb.Append("<li class='yellow'>"); break;
                default: sb.Append("<li class='gray'>"); break;
            }

            sb.Append("<span>" + (i + 1) + "</span>");
            sb.Append("<a href='New.aspx?id=" + item.ID + "' target='_blank'>" + StringHelper.CutString(item.Name, 28) + "</a>");
            sb.Append("</li>");
        }

        sb.Append("</ul>");

        return sb.ToString();
    }
}